var ajax = function(method, url,param, callback) {

    var xhr = new XMLHttpRequest();
    xhr.open(method, url, true);
    
    if (method.toLocaleLowerCase()=='post') {
        xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded")
        xhr.send(param);
    }else {
        xhr.send();
    }

    xhr.onreadystatechange = function() {
        if (xhr.readyState == 4 && xhr.status == 200) {
            callback(JSON.parse(xhr.responseText));
        }
    }

};

var $ = function(id) {
    if (typeof id == 'string') {
        return document.getElementById(id);
    } else {
        return id; 
    }

};